#ifndef __ming_fyp_core_Exception_h__
#define __ming_fyp_core_Exception_h__

//------------------------------------------------------------------------------
// header includes
#include <stdexcept>
#include "fyp/core/String.h"

#define EXCEPTION(src, reason) throw ming::fyp::core::TException(src, reason)

//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
namespace core
{
	//--------------------------------------------------------------------------
	class TException : public std::exception
	{
	public:
		//------------------------------
		// #cstor & #dstor
		TException(
			const TStr &source,
			const TStr &reason) :
			mSource(source),	
			mReason(reason)
		{
		}

		virtual ~TException() {}
		
		//------------------------------
		// external operations
		virtual const char* what() const
		{
			mWhat = "From " + mSource + ": " + mReason;
			return C_STR(mWhat);
		}
		
	private:
		//------------------------------
		// internal attributes
		TStr mSource;
		TStr mReason;
		TStr mWhat;

		//------------------------------
		// internal operations
	};
	
	//--------------------------------------------------------------------------
}
}
}

using namespace ming::fyp::core;

#endif	//__ming_fyp_core_Exception_h__